import os # 导入 os 模块
import sys # 导入 sys 模块

from routes.acl.adduser import acl_adduser
from routes.acl.menu import acl_menu
from routes.acl.role import acl_role
from routes.not_shipped.query import notshipped
from routes.picking_team.eu_rework import Eu
from routes.sign_bill.qd_print import sign
from routes.slot_management.assign_slot import assign_slot
from routes.slot_management.inventoryQuery import inventoryQuery_slot
from routes.slot_management.slot_outbound import outbound_slot
from routes.slot_management.slot_query import query_slot
from routes.slot_management.slot_upkeep import upkeep_slot
from routes.package_material import router as package_material_router
from routes.package_material.report import router as report_router

from util import ip

root_path = os.getcwd() # 获取当前工作目录
sys.path.append(root_path) # 将当前工作目录添加到 sys.path 中

from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from routes.acl.user import acl_user
from routes.login.login import appLogin
app = FastAPI()
app.add_middleware(CORSMiddleware,
                   allow_origins=["*"],
                   allow_credentials=True,
                   allow_methods=["*"],
                   allow_headers=["*"])


app.include_router(appLogin, prefix="/login", tags=["登录"])
app.include_router(acl_user, prefix="/acl", tags=["权限_用户管理"])
app.include_router(acl_role, prefix="/role", tags=["权限_角色管理"])
app.include_router(acl_menu, prefix="/menu", tags=["权限_菜单管理"])
app.include_router(acl_adduser, prefix="/acl_adduser", tags=["权限_添加蓝思用户"])
app.include_router(Eu, prefix="/picking", tags=["欧盟返工"])
app.include_router(notshipped, prefix="/not_shipped", tags=["未出货"])
app.include_router(sign, prefix="/sign_print", tags=["签单"])
app.include_router(assign_slot, prefix="/assign_slot", tags=["蓝思货位管理_分配货位"])
app.include_router(upkeep_slot, prefix="/upkeep_slot", tags=["蓝思货位管理_新增或修改货位"])
app.include_router(outbound_slot, prefix="/outbound_slot", tags=["蓝思货位管理_出库"])
app.include_router(query_slot, prefix="/query_slot", tags=["蓝思货位管理_查询"])
app.include_router(inventoryQuery_slot, prefix="/inventoryQuery_slot", tags=["蓝思货位管理_库存查询"])
app.include_router(package_material_router)
app.include_router(report_router)

if __name__ == "__main__":
    import uvicorn
    uvicorn.run("main:app", host=f"{ip}", port=8000,reload=False)
